<template>
  <div style="margin: 0 10px;">
    <div style="float:right;margin:5px 0px 5px 5px">
      <el-form :inline="true" style="text-align: right; padding-right: 0px;" label-width="68px">
        <el-form-item style="margin-bottom: 4px;margin-right: 0px;">
          <el-button type="primary" icon="el-icon-refresh" size="mini" @click="getList()">刷新</el-button>
        </el-form-item>
      </el-form>
    </div>
    <el-table :data="signList" border :show-overflow-tooltip="true">
      <el-table-column label="序号" align="center" width="60px" prop="rowNumber" />
      <el-table-column label="签字日期" align="center" prop="dtDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.dtDate, '') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="签字人" align="center" prop="ctUsername" width="100" />
      <el-table-column label="签字人隶属组织" align="left" header-align="center" prop="ctBranchname" />
      <el-table-column label="签字意见" align="left" header-align="center" prop="ctComment" />
      <el-table-column label="下一步接收人" align="center" prop="ctInceptName" width="100" />
      <el-table-column label="备注" align="left" prop="ctMark" header-align="center" width="150" />
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import { listSign } from './SignList'
export default {
  name: 'ListSign',
  data() {
    return {
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,
      // 签字信息表格数据
      signList: [],
      // 查询参数（父窗体直接控制）
      queryParams: {
        pageNum: 1,
        pageSize: 20,
        ctBussId: null,
      },
    }
  },
  methods: {
    /** 查询签字信息列表 */
    getList() {
      // 新增时，则不请求
      this.loading = true
      listSign(this.queryParams)
        .then((response) => {
          this.signList = response.rows
          this.total = response.total
          this.loading = false
          this.$emit('updateTotal', this.total)
        })
        .catch(() => {
          this.loading = false
        })
    },
  },
}
</script>
